<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html" 
	xmlns:r="http://richfaces.org/rich" 
	xmlns:a="http://richfaces.org/a4j"
	xmlns:p="http://primefaces.prime.com.tr/ui" 
	xmlns:ad="http://agiledev.com.br/fieldset">
	
	<ui:component>
	
		<h:form id="taskForm">
	
			<s:decorate template="/layout/comands.xhtml">
				<a:commandButton value="#{messages.novo}" action="#{mb.newTask(tas.item)}" reRender="#{rr},taskForm" ajaxSingle="true"/>
				<h:outputText value=" " />
				<a:commandButton value="#{messages.gravar}" actionListener="#{mb.persistTask}" data="#{eventContext.get('controle')}" reRender="#{rr},taskForm"/>
				<h:outputText value=" " />
				<a:commandButton value="#{messages.excluir}" actionListener="#{mb.removeTask}" data="#{eventContext.get('controle')}" reRender="#{rr},taskForm" rendered="#{not empty tas.oid}"/>			
			</s:decorate>
		
			<ad:fieldset legenda="#{messages.item}">
				<s:decorate	template="/layout/display.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.item}" />
					</ui:define>
					<h:outputText value="#{tas.item.nome}" />	
				</s:decorate>

				<s:decorate	template="/layout/display.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.prioridade}" />
					</ui:define>
					<ui:include src="/pages/item/prioridade.xhtml">
						<ui:param name="valor" value="#{tas.item.prioridade}" />
					</ui:include>
				</s:decorate>

				<s:decorate	template="/layout/display.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.estimativa}" />
					</ui:define>
					<h:outputText value="#{tas.item.estimativa}" />	
				</s:decorate>
				
				<s:div style="clear: left;">
					<r:simpleTogglePanel switchType="client" opened="false" label="#{messages.tasks}" styleClass="semBorda" >				
						<r:dataTable id="dtTarefas" value="#{tas.item.tarefas}" var="t" width="100%" rows="7">
							<r:column>
								<f:facet name="header">
									<h:outputText value="#{messages.descricao}" />
								</f:facet>
								<h:outputText value="#{t.descricao}" />
							</r:column>
							
							<r:column styleClass="centro" width="10%">
								<f:facet name="header">
									<h:outputText value="#{messages.acoes}" />
								</f:facet>
								
								<a:commandLink action="#{mb.editTask(t)}" ajaxSingle="true" title="#{messages.editar}" reRender="taskForm">
									<h:graphicImage value="/img/note_edit.png" />
								</a:commandLink>
								
							</r:column>				
							
							<f:facet name="footer">
								<r:datascroller for="dtTarefas"/>
							</f:facet>
								
						</r:dataTable>		
					</r:simpleTogglePanel>		
				</s:div>
			</ad:fieldset>
		
			<ad:fieldset legenda="#{messages.task}">
			
				<s:decorate	template="/layout/edit.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.descricao}" />
					</ui:define>
					<h:inputTextarea value="#{tas.descricao}" rows="4" cols="50" required="true"/>
				</s:decorate>
		
			</ad:fieldset>
	
		</h:form>
	</ui:component>
</html>